﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage_user.master" AutoEventWireup="true" CodeFile="tinnhantraloi.aspx.cs" Inherits="tinnhantraloi" %>

<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="user_content" Runat="Server">
    <br>
    <div class="title">Biểu Đồ Tin Nhắn</div>
    
    <div class="featureChart">
        <div class="radioButton">
            <asp:RadioButton ID="rbTraLoi" runat="server" Checked="True" Text="Tin nhắn trả lời" GroupName="bieudo" />
            <br><asp:RadioButton ID="rbThacMac" runat="server" GroupName="bieudo" onclick="location.href='tinnhanthacmac.aspx'"
                Text="Tin nhắn thắc mắc" />
        </div>
        <div class="comboBox">
            Kiểu:&nbsp;<asp:DropDownList ID="dl_KieuBieuDo" runat="server" AutoPostBack="True" 
                onselectedindexchanged="dl_KieuBieuDo_SelectedIndexChanged">
                <asp:ListItem Value="column">Biểu đồ cột</asp:ListItem>
                <asp:ListItem Value="line">Biểu đồ đường</asp:ListItem>
            </asp:DropDownList>
        </div>
    </div> 

    <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1" 
        Width="777px" Height="416px" onload="Chart1_Load">
    <series>
        <asp:Series Name="Series1" XValueMember="ThoiGian" YValueMembers="SoLuong" 
            ChartArea="ChartArea1" Legend="Legend1" Font="Microsoft Sans Serif, 10pt" 
            IsValueShownAsLabel="True">
        </asp:Series>
    </series>
    <chartareas>
        <asp:ChartArea Name="ChartArea1">
            <AxisY Title="Số lượng" TitleFont="Arial, 10pt, style=Bold" 
                TitleForeColor="80, 124, 209">
                <MajorGrid Enabled="False" />
                <MajorTickMark Enabled="False" />
            </AxisY>
            <AxisX IntervalAutoMode="VariableCount" Title="Thời gian" 
                TitleFont="Arial, 10pt, style=Bold" TitleForeColor="80, 124, 209">
                <MajorGrid Enabled="False" />
                <MajorTickMark Enabled="False" />
            </AxisX>
        </asp:ChartArea>
    </chartareas>
</asp:Chart>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:chodientuConnectionString2 %>" SelectCommand="select COUNT(Matinnhan) as SoLuong, CONVERT(VARCHAR(50),Ngaygoi, 103) AS ThoiGian
from Tinnhan
where ([Username] = @Username) and CONVERT(VARCHAR(50),Ngaygoi, 103) in (
	SELECT top 10 CONVERT(VARCHAR(50),Ngaygoi, 103)
	FROM [Tinnhan] 
	Group by CONVERT(VARCHAR(50),Ngaygoi, 103)
	order by CONVERT(VARCHAR(50),Ngaygoi, 103) desc)
group by CONVERT(VARCHAR(50),Ngaygoi, 103)">
        <SelectParameters>
            <asp:SessionParameter Name="Username" SessionField="User" />
        </SelectParameters>
</asp:SqlDataSource>
</asp:Content>

